﻿using CCWin;
using Commodity;
using customer;
using employee;
using gongyingshang;
using ku;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TelephoneYiShou.XQL;

namespace TelephoneYiShou
{
    public partial class FrmMain : Skin_Mac
    {
        public string loginname;
        public FrmMain(string Ename)
        {
            InitializeComponent();
            loginname = Ename;
        }
        private void 退出系统ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();//退出系统
        }

        private void 销售出库统计ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmSaleCount frmSaleCount = new FrmSaleCount();
            frmSaleCount.Show();

        }
        //注意事项
        private void 系统关于ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBoxEx.Show("注意事项：\n  系统运行时，尽量不要使用占用系统资源较多的程序，因为可能导致电脑出现死机现象，从而造成数据丢失", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            
        }
        //供应商信息录入页面
        private void 供应商信息录入ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            addSupplier adds = new addSupplier();
            adds.Show();
        }
        //供应商信息维护页面
        private void 供应商信息维护ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            changeSupplier chsu = new changeSupplier();
            chsu.Show();
        }
        //供应商信息查询页面
        private void 供应商信息一览ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            readSupplier resu = new readSupplier();
            resu.Show();
        }
        //员工信息录入页面
        private void 员工信息录入ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            empAdd empa = new empAdd();
            empa.Show();
        }
        //员工信息维护页面
        private void 员工信息维护ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            empChange empch = new empChange();
            empch.Show();
        }
        //员工信息查询页面
        private void 员工信息一览ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            empCheck empcl = new empCheck();
            empcl.Show();
        }
        //客户信息录入页面
        private void 客户信息添加ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cusAdd cua = new cusAdd();
            cua.Show();
        }
        //客户信息维护页面
        private void 客户信息维护ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cusChange cuc = new cusChange();
            cuc.Show();
        }
        //客户信息一览页面
        private void 客户信息一览ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cusClear cusch = new cusClear();
            cusch.Show();
        }
        //商品类型管理页面
        private void 商品类型管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmGoodsType fgt = new FrmGoodsType();
            fgt.Show();
        }
        //员工业绩页面
        private void 员工业绩ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmEmpPer fep = new FrmEmpPer();
            fep.Show();
        }
        //进货入库统计页面 
        private void 销售业绩统计ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmBuyCount fbc = new FrmBuyCount();
            fbc.Show();
        }
        //采购计划
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            FrmShoppingPlan fsp = new FrmShoppingPlan();
            fsp.Show();
        }
        //进货入库
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            FrmStockInventory fsi = new FrmStockInventory();
            fsi.Show();
        }
        //销售出库
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            FrmSaleGoods fsg = new FrmSaleGoods(loginname);
            fsg.Show();
        }
        //盘点库存
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            FrmInventory fi = new FrmInventory();
            fi.Show();
        }
        //商品录入
        private void 商品信息录入ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Commodityadd commodityadd = new Commodityadd();
            commodityadd.Show();
        }

        private void 商品信息维护ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
            Commodityselect commodityselect = new Commodityselect();
            commodityselect.Show();

        }

        private void 商品信息一览ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Commodityread commodityread = new Commodityread();
            commodityread.Show();
        }

        private void 查看进货记录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Jhdd jhdd = new Jhdd();
            jhdd.Show();
        }

        private void 销售出库ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmSalesMGT frmSalesMGT = new FrmSalesMGT();
            frmSalesMGT.Show();
        }

        private void 盘点库存ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmInventory fi = new FrmInventory();
            fi.Show();
        }

        private void 退出登录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            string sql = "select commodityname,colour,sum from stock s,commodity c where s.commodityid = c.commodityid and sum<=20";
            DataTable dt = DBHelper.GetDataTable(sql);
            string s = "";
            if (dt.Rows.Count==0)
            {
                return;
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                s += dt.Rows[i][0].ToString();
                s += " ";
                s+= dt.Rows[i][1].ToString();
                s += "，";
            }
            MessageBoxEx.Show(s+"的库存不足20件，请及时补充库存","库存提醒",MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
    }
}
